#ifndef jjb_solutionpool

#define jjb_solutionpool


#include "solution.h"
#include "dataset.h"

using namespace std;
class solutionpool
{
public:
    static const int SP_MAX_CAPACITY = 120;
    const int TARGET_SIZE;

    solutionpool(dataset* theTrainSet, dataset* theTestSet, int tmpTargetSize)
        : trainingSet(theTrainSet), testSet(theTestSet), bestSolution(NULL),
          TARGET_SIZE(tmpTargetSize), nSolNo(1) 
        { for (int i = 0; i < SP_MAX_CAPACITY; i++) thePool[i] = NULL;}

    ~solutionpool();   

    void insertSolution(solution* tmpSolution);
    
    int getCount();

    solution* getRandomSolution();
    solution* getBestSolution() { return bestSolution; }
    void setNthSolution(int n, solution* sol) { assert(n >= 0 && n < SP_MAX_CAPACITY); 
                                                thePool[n] = sol; }
    solution* getNthSolution(int n) { assert(n >= 0 && n < SP_MAX_CAPACITY); 
                                      return thePool[n]; }

    dataset* getTrainingSet() { return trainingSet; }
    dataset* getTestSet() { return trainingSet; }

    void outputBest() {
        if (bestSolution == NULL)
            assert(bestSolution != NULL); 
        bestSolution->display(); }
private:
    dataset* trainingSet;
    dataset* testSet;

    solution* thePool[SP_MAX_CAPACITY];
    solution* bestSolution;

    int nSolNo;
};


#endif
